Skip to content

Fix max_codes=0 (unlimited) in the binary IVF count scanner - #5583

Open
rioyu123 wants to merge 1 commit into
facebookresearch:mainfrom
rioyu123:codex/fix-binary-ivf-count-max-codes-zero
Open

Fix max_codes=0 (unlimited) in the binary IVF count scanner#5583
rioyu123 wants to merge 1 commit into
facebookresearch:mainfrom
rioyu123:codex/fix-binary-ivf-count-max-codes-zero

Conversation

@rioyu123

@rioyu123 rioyu123 commented Sep 5, 2026

Copy link
Copy Markdown

Related to #5555, reported by @leemeii.

Summary

With IndexBinaryIVF.use_heap=false, max_codes=0 currently stops the count
scanner before it examines any codes. Searches using the default unlimited
budget therefore return only missing-result placeholders.

This patch gives the count scanner the same zero-budget normalization as the
heap scanner. Index-level defaults and per-search zero overrides now
mean unlimited scanning; positive budgets retain their existing behavior.

Coordination

I asked in #5555 whether the original reporter already has a patch in progress.
I'm sharing this small implementation for review, without
assuming that coordination is settled. If there is work underway, I'm happy
to coordinate and avoid overlapping submissions.

Validation

  • Added a deterministic regression with both inverted lists populated. It
    compares the count and heap scanners with IndexBinaryFlat for the default
    zero budget and an explicit zero override, and checks that a positive budget
    still limits the results.
  • The new test fails on the unchanged base and passes with this patch.
  • Both binary IVF tests in test_lowlevel_ivf.cpp and the existing TPOB.IVF
    parameter-override test pass against the CPU-only source build.
  • git diff --check and the changed-lines git clang-format check pass.

The full low-level IVF test file reached a 60-second time limit in the existing
IVFRQ test, after the first eight tests passed. Full-suite, GPU, and Python
binding validation were not completed.

@meta-cla meta-cla Bot added the CLA Signed label Sep 5, 2026
@rioyu123
rioyu123 marked this pull request as ready for review September 5, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant